﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _04Test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        int a = int.Parse(TextBox1.Text);
        int b = int.Parse(TextBox2.Text.ToString());
        int c = int.Parse(TextBox3.Text);
        int m = b * b - 4 * a * c;
        if (m < 0)
        {
            Label4.Text = ("ax2+bx+c=0该方程无解!!!");
        }
        else if (m == 0)
        {
            double x = -b / 2 * a;
            Label4.Text = ("ax2+bx+c=0 的解为：x=" +x);
        }
        else {
            double x1 = (-b - Math.Sqrt(m)) / 2 * a;
            double x2 = (-b + Math.Sqrt(m)) / 2 * a;
            Label4.Text = ("ax2+bx+c=0 的解为：x1=" +x1+",x2="+x2);
        }
    }
}